import React from 'react';
import { Modal, Layout } from 'antd';
import Title from './Title';
import './index.less';
/* eslint-disable */
const MyModal = props => {
  let title = props.title;
  if (typeof title === 'string') {
    title = <Title {...props} />;
  }
  const embed = props.embed;
  const newProps = {
    ...props,
    title: title,
    width: props.width || '50%',
    wrapClassName: 'web-modal',
  };
  delete newProps.onSave;
  delete newProps.icon;
  delete newProps.embed;
  if (embed) {
    return <Layout className="web-modal-embed">
      <div className="web-modal-embed-header">
        {title}
      </div>
      <Layout.Content className="web-modal-embed-body">
        {props.children}
      </Layout.Content>
    </Layout>;
  } else {
    return <Modal {...newProps}>{props.children}</Modal>;
  }
};
export default MyModal;
